﻿using Microsoft.AspNetCore.Http;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;

namespace HelloCore.Extensions
{
    public class CustomMiddleWare
    {
        private readonly RequestDelegate _next;
        public CustomMiddleWare(RequestDelegate next)
        {
            this._next = next;
        }

        public async Task InvokeAsync(HttpContext httpContext)
        {
            await httpContext.Response.WriteAsync("Before...");
            await _next.Invoke(httpContext);
            await httpContext.Response.WriteAsync("After...");
        }
    }
}
